<?php
/* ------------------------------------------------------------------------ */
/* Featured Slider
/* ------------------------------------------------------------------------ */
global $sd_data;
?>

<div id="featuredslider" class="flexslider">
	<div class="thumbs"></div>
	<?php
		$slides = $sd_data['featured_slider']; //get the slides array
	?>
	<ul class="captions">
		<?php foreach ($slides as $slide) : ?>
		<li>
			<h3><?php echo $slide['title']; ?></h3>
			<?php if (!empty($slide['description'])) : ?>
			<p class="flex-caption"><?php echo do_shortcode($slide['description']); ?></p>
			<?php endif; ?>
		</li>
		<?php endforeach; ?>
	</ul>
	<ul class="slides">
	<?php
		foreach ($slides as $slide) :
			// set the image url
			$image_url = $slide['url'];
		 	// store the image ID in a var
			$image_id = sd_attachment_id_from_url($image_url);
		 	// retrieve the thumbnail size of our image
			$image_thumb = wp_get_attachment_image_src($image_id, 'slider-thumb');
	?>
		<li data-thumb="<?php echo $image_thumb[0]; ?>"> <a <?php echo $slide_link = (!empty($slide['link'])) ? 'href="'.$slide['link'].'"' : '' ?>><img src="<?php echo $slide['url']; ?>" alt="" /></a> </li>
		<?php endforeach; ?>
	</ul>
</div>
